package com.grad.why.studentsystem.service.qlxservice.qlximpl;


import com.alibaba.dubbo.config.annotation.Service;
import com.grad.why.studentsystem.domain.qlxdomain.StudentMenu;
import com.grad.why.studentsystem.mapper.qlxmapper.StudentMenuMapper;
import com.grad.why.studentsystem.service.qlxservice.StudentMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;

@Component
@Service(interfaceClass = StudentMenuService.class)
@Transactional
public class StudentMenuServiceImpl implements StudentMenuService{
    @Autowired
    private StudentMenuMapper studentMenuMapper;
    @Override
    public ArrayList<StudentMenu> getStudentMenuInfos() {
        return studentMenuMapper.getStudentMenuInfos();
    }

    @Override
    public ArrayList<StudentMenu> getStudentMenuInfosByUserType(int type) {
        try{
            return studentMenuMapper.getStudentMenuInfosByUserType(type);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public StudentMenu getStudentMenuInfoByMenuId(Integer studentmenuid) {
        try{
            return studentMenuMapper.selectByPrimaryKey(studentmenuid);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
}
